#ifndef __SEN_LINE_H
#define __SEN_LINE_H

#include "stdint.h"
#include "mytype.h"
#include "correct.h"

#ifdef __cplusplus
extern "C"
{
#endif

	typedef struct
	{
		struct
		{
			dict_i16_type zero;
			dict_i16_type full;
		} line;

		struct
		{
			ii16 low, high;
		} limit;

		struct
		{
			ii16 low, high;
		} err_limit;

		struct
		{
			const void *point_list;
			uu08 list_len; 
			ii16 pb, pk;
			float offset_before, offset_after; 
		} correct;

		struct
		{
			float f_org, f_real, f_ctr, f_disp;
			ii16 i_org, i_ctr, i_disp;
		} result;

		float filter; 
		ii16 adc_val; 
		uu08 err;	  

	} sen_b16_line_type;

	typedef struct
	{
		struct
		{
			dict_i32_type zero;
			dict_i32_type full;
		} line;

		struct
		{
			ii32 low, high;
		} limit;

		struct
		{
			ii32 low, high;
		} err_limit;

		struct
		{
			const void *point_list;
			uu08 list_len; 
			ii32 pb, pk;
			float offset_before, offset_after; 
		} correct;

		struct
		{
			float f_org, f_real, f_ctr, f_disp;
			ii32 i_org, i_ctr, i_disp;
		} result;

		float filter; 
		ii32 adc_val; 
		uu08 err;	  

	} sen_b32_line_type;

	typedef struct
	{
		int16_t ad_max;			
		int16_t ad_val;			
		uint16_t res_ref;		
		uint16_t res_25c;		
		uint16_t ntc_b;			
		int16_t cb;				
		i16_limit_type ad_rang; 
		i16_limit_type limit;	
		float filter;			
		uint8_t b_cf;			

		uint8_t err;
		struct
		{
			float f_ctr;
			float f_disp;
			int16_t i_ctr;
			int16_t i_disp;
		} result;
	} ntc_obj_type;

	float sen_b16_line_cal(sen_b16_line_type *obj);
	void sen_b16_line_reset(sen_b16_line_type *obj, int16_t result);

	float sen_b32_line_cal(sen_b32_line_type *obj);
	void sen_b32_line_reset(sen_b32_line_type *obj, int32_t result);

	void ntc_cal(ntc_obj_type *obj);

#ifdef __cplusplus
}
#endif

#endif 
